<template>
  <div class="keep head-title">
    <div class="title1">设备保养</div>
    <div class="head">
      <div class="left">
          <router-link tag="div" :to="item.path" :class="item.name == currentName ? 'title' : '' " 
          v-for="item in list" :key="item.name"
          @click="changedItem(item.name)">
            {{ item.name }}
          </router-link>
      </div>
      <div>
          <router-view class="right"></router-view>
      </div>
    </div>
    
  </div>
</template>

<script>
export default {
  data() {
    return {
      currentName:null,
      list:[
        {name:'保养项目',path:'/home/keep/project'},
        {name:'保养计划',path:'/home/keep/plan'},
        {name:'保养任务',path:'/home/keep/project'},
        {name:'保养工单',path:'/home/keep/project'}
      ]
    }
  },
  methods:{
    changedItem(name){
      this.currentName = name;
    }
  },
  mounted(){
    this.currentName = this.list[0].name;
  }

}
</script>

<style scoped>

.head{
  display: flex;
  height: 40px;
  margin-left: 20px;
}
.left{
  height: 100vh;
  border-right: 2px solid #f4f4f4;   
  background-color: #fff;
}
.left>div{
  text-align: center;
  line-height: 36px;

}
.title1{
  
  margin: 20px;
}
.title{

  color: cornflowerblue;
}
.title:hover{
  line-height: center;
  color: cornflowerblue;
}
</style>